<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>斐波那契计算器</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
        }
        h1 {
            color: #333;
        }
        form {
            background-color: #fff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            width: 300px;
            text-align: center;
        }
        label {
            margin-bottom: 10px;
            font-size: 18px;
        }
        input[type="number"] {
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            font-size: 16px;
            margin-bottom: 20px;
        }
        select {
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            margin-bottom: 20px;
        }
        button {
            padding: 10px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 5px;
            font-size: 16px;
            cursor: pointer;
        }
        button:hover {
            background-color: #0056b3;
        }
        table {
            margin-top: 30px;
            width: 80%;
            border-collapse: collapse;
            background-color: #fff;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        th, td {
            border: 1px solid #ccc;
            padding: 10px;
            text-align: center;
        }
        th {
            background-color: #007BFF;
            color: white;
        }
    </style>
</head>
<body>
    <h1>斐波那契计算器</h1>
    <form action="{% url 'fibonacci_comparison' %}" method="post">
        {% csrf_token %}
        <label for="number">请输入一个数字 (n)：</label>
        <input type="number" id="number" name="n" required>

{#        <label for="method">选择计算方法：</label>#}
{#        <select id="method" name="method">#}
{#            <option value="iterative">非递归</option>#}
{#            <option value="iterative_improve">非递归(改进)</option>#}
{#            <option value="recursive">递归</option>#}
{#            <option value="binet">Binet 公式</option>#}
{#            <option value="matrix">矩阵递推</option>#}
{#        </select>#}

        <button type="submit">计算</button>
        <br>
        <button><a href="{% url 'experiment1' %}" style="text-decoration: none; color: white">返回上一页</a></button>
    </form>
    <table>
        <thead>
            <tr>
                <th>输入的数字 (n)</th>
                <th>使用的算法</th>
                <th>计算结果</th>
                <th>基本操作</th>
                <th>操作次数</th>
                <th>执行时间 (微秒)</th>
                <th>空间效率</th>
            </tr>
        </thead>
        <tbody>
            {% for result in results %}
                <tr>
                    <td>{{ result.number }}</td>
                    <td>{{ result.method }}</td>
                    <td>{{ result.result }}</td>
                    <td>{{ result.base_operate }}</td>
                    <td>{{ result.base_operate_times }}</td>
                    <td>{{ result.execution_time }}</td>
                    <td>{{ result.space_ef }}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
</body>
</html>
